Authority API and URL & QR code device linking #572
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows for authority transfer between multiple clients at the same time.
Demo
Kapture.2023-09-01.at.17.03.09.mp4
How it works
program.authority.provide()
with authorisation queries. Queries are a way to select various UCANs and access keys. Above we have three queries: (1) query for the account capabilities (account component determines what these will be), (2 & 3) query for read & write access to the public & private roots of the file system.provide()
. This URL can be converted into a QR code.program.authority.request()
is called, it checks for the query params associated with the authority component implementation.authority[challenge]
andauthority[publicKey]
specifically..request()
detects the query params, establishes the channel via the channel component, making a websocket connection to the producer.private/subdir/
, the requestor cannot ask for acces toprivate/
)Names
File systems now have their own DID. I've added a names repo to manage the names for these DIDs. For example, when we do device linking, the new device doesn't know the DID of the file system they want request access to, instead we pass a name to the provider which then is resolved to a DID. It works like so:
.volume()
function which lives in the account implementation associates the nameaccount_fs_did#${root_identifier_did}
with the DID of the file system. This root identifier is the audience in the original file system UCAN and the FS DID is the issuer.volume
function will be different. In other words, when we receive the account UCANs from the provider device, the name will be the same.name
, not the DID.This does introduce a new
futile
state for thevolume
and file system loading. This state represents the in-between state where we know the name of the file system, but we haven't resolved the name yet. This is the state after requesting the account UCANs and before requesting the file system UCANs.Additional notes
provide
andrequest
at the same time.Other changes
Inventory
to also work with access keys.Test plan
This was originally tested with a specific commit of the Fission server, before the UCAN changes were made. However, I've also now made the SDK compatible with the Web3Storage UCAN ecosystem, I'll make a repo for that soon on my Github profile.